package com.gary.enums;
import java.util.HashMap;
import java.util.Map;
/**
 * 数据权限操作符
 *
 * @author Homan Liang
 * @date 2019/11/1
 */
public enum DataPermissionOperatorEnum {
    /**
     * 等于
     */
    EQ("=", "等于"),
    GT(">", "大于"),
    GTE(">=", "大于等于"),
    LT("<", "小于"),
    LTE("<=", "小于等于"),
    NEQ("!=", "不等于"),
    IN("in", "包含"),
    NOT_IN("not in", "不包含"),
    LIKE("like", "类似于"),
    IS("is", "是"),
    ;

    /**
     * 名称
      */
    private String name;
    /**
     * 描述
     */
    private String desc;

    private static final Map<String, DataPermissionOperatorEnum> lookup = new HashMap<>();

    static {
        for (DataPermissionOperatorEnum ase : DataPermissionOperatorEnum.values()) {
            lookup.put(ase.getName(), ase);
        }
    }

    DataPermissionOperatorEnum(String name, String desc) {
        this.name = name;
        this.desc = desc;
    }

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public String getDesc() {
        return desc;
    }

    public void setDesc(String desc) {
        this.desc = desc;
    }

    public static DataPermissionOperatorEnum get(String name) {
        return lookup.get(name);
    }
}
